const http = require('http')
let fs = require('fs')
http.createServer((request, response) => {
  let path = '../img/git命令速查表.jpg'
  response.setHeader('Access-Control-Allow-Origin', '*')
  //设置文件的响应类型
  //response.setHeader('Content-type', 'image/jpeg')
  response.setHeader('Content-type', 'application/x-jpg')
  fs.readFile(path, (err, res) => {
    response.write(res)
    response.end()
  })
}).listen(8003, '127.0.0.1', () => {
  console.log('Server is running!')
})